"use strict";(globalThis.webpackChunk_wcAdmin_webpackJsonp=globalThis.webpackChunk_wcAdmin_webpackJsonp||[]).push([[3307],{33284:(e,t,o)=>{o.r(t),o.d(t,{default:()=>h});var n=o(69307),r=o(14599),a=o(9818),c=o(55609),i=o(67221),l=o(47492),s=o(51393),m=o(65736),d=o(86020);const u=e=>{let{onClose:t}=e;const o={placement:"auto",options:{effects:{spotlight:{interactivity:{enabled:!1}},liveResize:{mutation:!0,resize:!0}}},steps:[{referenceElements:{desktop:".woocommerce-product-form-tab__general .woocommerce-form-section__content"},meta:{name:"story",heading:(0,m.__)("📣 Tell a story about your product","woocommerce"),descriptions:{desktop:(0,m.__)("The product form will help you describe your product field by field—from basic details like name and description to attributes the customers can use to find it on your store.","woocommerce")}}},{referenceElements:{desktop:"#tab-panel-0-pricing"},meta:{name:"tabs",heading:(0,m.__)("✍️ Set up pricing & more","woocommerce"),descriptions:{desktop:(0,m.__)("When done, use the tabs to switch between other details and settings. In the future, you’ll also find here extensions and plugins.","woocommerce")}}},{referenceElements:{desktop:".woocommerce-product-form-actions"},meta:{name:"actions",heading:(0,m.__)("🔍 Preview and publish","woocommerce"),descriptions:{desktop:(0,m.__)("With all the details in place, use the buttons at the top to easily preview and publish your product. Click the arrow button for more options.","woocommerce")}}},{referenceElements:{desktop:".woocommerce-product-form-more-menu"},meta:{name:"more",heading:(0,m.__)("⚙️ Looking for more?","woocommerce"),descriptions:{desktop:(0,m.__)("If the form doesn’t yet have all the features you need —it’s still in development— you can switch to the classic editor anytime.","woocommerce")}}}],closeHandler:t};return(0,n.createElement)(d.TourKit,{config:o})};var p=o(43729);const _=e=>{let{onClose:t,onStart:o}=e;return(0,n.createElement)(c.Modal,{bodyOpenClassName:"woocommerce-product-tour-modal__modal-open",className:"woocommerce-product-tour-modal",onRequestClose:()=>t(),overlayClassName:"woocommerce-product-tour-modal__overlay",shouldCloseOnClickOutside:!1,title:(0,m.__)("Meet the product editing form","woocommerce")},(0,n.createElement)("div",{className:"woocommerce-product-tour-modal__header-img"},(0,n.createElement)("img",{src:p,alt:(0,m.__)("Product editing tour","woocommerce")})),(0,n.createElement)("div",{className:"woocommerce-product-tour-modal__content"},(0,n.createElement)("p",null,(0,m.__)("Let us show you how to navigate the form and create this product from start to finish in no time.","woocommerce")),(0,n.createElement)("div",{className:"woocommerce-product-tour-modal__actions"},(0,n.createElement)(c.Button,{variant:"tertiary",onClick:()=>t()},(0,m.__)("I'll explore on my own","woocommerce")),(0,n.createElement)(c.Button,{variant:"primary",onClick:()=>{o()}},(0,m.__)("Show me around (10s)","woocommerce")))))},g="woocommerce_product_tour_modal_hidden",E=()=>{const{dismissModal:e,endTour:t,isModalHidden:o,isTouring:r,startTour:c}=(()=>{const[e,t]=(0,n.useState)(!1),{updateOptions:o}=(0,a.useDispatch)(i.OPTIONS_STORE_NAME),{isModalHidden:r}=(0,a.useSelect)((e=>{const{getOption:t,hasFinishedResolution:o}=e(i.OPTIONS_STORE_NAME);return{isModalHidden:"yes"===t(g)||!o("getOption",[g])}})),c=()=>{o({[g]:"yes"})};return{dismissModal:c,endTour:()=>{t(!1)},isModalHidden:r,isTouring:e,startTour:()=>{c(),t(!0)}}})(),{maybeShowFeedbackBar:l}=(0,s.__experimentalUseFeedbackBar)();return r?(0,n.createElement)(u,{onClose:()=>{t(),l()}}):o?null:(0,n.createElement)(_,{onClose:()=>{e(),l()},onStart:c})};o(40033);const h=()=>{const{isLoading:e}=(0,a.useSelect)((e=>{const{hasFinishedResolution:t}=e(i.EXPERIMENTAL_PRODUCT_FORM_STORE_NAME);return{isLoading:!t("getProductForm")}}));return(0,n.useEffect)((()=>{(0,r.recordEvent)("view_new_product_management_experience")}),[]),(0,n.createElement)("div",{className:"woocommerce-add-product"},e?(0,n.createElement)("div",{className:"woocommerce-edit-product__spinner"},(0,n.createElement)(c.Spinner,null)):(0,n.createElement)(n.Fragment,null,(0,n.createElement)(l.H,null),(0,n.createElement)(E,null)))}},54159:(e,t,o)=>{o.r(t),o.d(t,{default:()=>T});var n=o(69307),r=o(65736),a=o(67221),c=o(14599),i=o(9818),l=o(86020),s=o(85597),m=o(47492),d=o(15859),u=o(5267),p=o(98817),_=o(23374),g=o(44581),E=o(89097),h=o(83849),w=o.n(h);function N(e){let{actionLabel:t,actionHref:o,prevHref:a,prevLabel:c,nextHref:i,nextLabel:s,className:m,...d}=e;const p={className:"posts-navigation__prev","aria-label":null!=c?c:(0,r.__)("Previous post","woocommerce"),children:(0,n.createElement)(_.Z,{icon:g.Z,size:24,fill:"currentColor"})},h={className:"posts-navigation__next","aria-label":null!=s?s:(0,r.__)("Next post","woocommerce"),children:(0,n.createElement)(_.Z,{icon:E.Z,size:24,fill:"currentColor"})};return(0,n.createElement)("nav",(0,u.Z)({},d,{className:w()(m,"posts-navigation")}),a?(0,n.createElement)(l.Link,(0,u.Z)({},p,{type:"wc-admin",href:a})):(0,n.createElement)("div",(0,u.Z)({},p,{tabIndex:-1,role:"button","aria-disabled":"true"})),(0,n.createElement)(l.Link,{className:"posts-navigation__action",type:"wc-admin",href:o},t),i?(0,n.createElement)(l.Link,(0,u.Z)({},h,{type:"wc-admin",href:i})):(0,n.createElement)("div",(0,u.Z)({},h,{tabIndex:-1,role:"button","aria-disabled":"true"})))}var b=o(19784),v=o(55609),I=o(46530),C=o(51393),f=o(10431);const S=()=>{const{productId:e,variationId:t}=(0,s.UO)(),{isDirty:o,isValidForm:c,values:m}=(0,l.useFormContext)(),{updateProductVariation:d}=(0,i.useDispatch)(a.EXPERIMENTAL_PRODUCT_VARIATIONS_STORE_NAME),{createNotice:u}=(0,i.useDispatch)("core/notices"),[p,_]=(0,n.useState)(!1);(0,f.useConfirmUnsavedChanges)(o,C.preventLeavingProductForm);const g=async()=>{_(!0),d({id:t,product_id:e,context:"edit"},{...m,manage_stock:"parent"===m.manage_stock||null==m?void 0:m.manage_stock}).then((()=>{u("success",`🎉‎ ${(0,r.__)("Product variation successfully updated.","woocommerce")}`)})).catch((()=>{u("error",(0,r.__)("Failed to updated product variation.","woocommerce"))})).finally((()=>{_(!1)}))};return(0,n.createElement)(I.WooHeaderItem,null,(()=>(0,n.createElement)("div",{className:"woocommerce-product-form-actions is-variation"},(0,n.createElement)(v.Button,{href:m.permalink+"?preview=true",disabled:!c||!m.permalink,target:"_blank",className:"woocommerce-product-form-actions__preview"},(0,r.__)("Preview","woocommerce")),(0,n.createElement)(v.ButtonGroup,{className:"woocommerce-product-form-actions__publish-button-group"},(0,n.createElement)(v.Button,{onClick:g,variant:"primary",isBusy:p,disabled:!c||!o},(0,r.__)("Save","woocommerce"))))))};(0,p.registerPlugin)("product-variation-action-buttons-header-item",{render:S,icon:"admin-generic"});var x=o(58378);const k=()=>(0,n.createElement)(n.Fragment,null,(0,n.createElement)(x.t,null),(0,n.createElement)(S,null)),P=e=>{let{product:t,productVariation:o}=e;const a=(0,n.useRef)(),c=(0,n.useRef)(null),i=function(e){var t;let{product:o,productVariation:n}=e;const{variations:r}=o,a=null!=r?r:[],c=a.indexOf(null!==(t=n.id)&&void 0!==t?t:-1),i=c>0,l=c<a.length-1,s=i?a[c-1]:void 0,m=l?a[c+1]:void 0,d=(0,f.getPersistedQuery)();return{actionHref:(0,f.getNewPath)(d,`/product/${o.id}`,{}),prevHref:s?(0,f.getNewPath)(d,`/product/${o.id}/variation/${s}`,{}):void 0,nextHref:m?(0,f.getNewPath)(d,`/product/${o.id}/variation/${m}`,{}):void 0}}({product:t,productVariation:o});return(0,n.useEffect)((()=>{var e;o&&a.current!==o.id&&(null===(e=c.current)||void 0===e||e.resetForm(o),a.current=o.id)}),[o]),(0,n.createElement)(l.SlotContextProvider,null,(0,n.createElement)(l.Form,{initialValues:o,errors:{},ref:c},(0,n.createElement)(k,null),(0,n.createElement)(d.a,{key:o.id,id:"variation",product:o}),(0,n.createElement)(b.H,null),(0,n.createElement)("div",{className:"product-variation-form__navigation"},(0,n.createElement)(N,(0,u.Z)({},i,{actionLabel:(0,r.__)("Return to main product","woocommerce"),prevLabel:(0,r.__)("Previous product variation","woocommerce"),nextLabel:(0,r.__)("Next product variation","woocommerce")}))),(0,n.createElement)(p.PluginArea,{scope:"woocommerce-product-editor"})))};o(40033);const T=()=>{var e,t;const{productId:o,variationId:u}=(0,s.UO)(),p=!!u,_=(0,n.useRef)(),g=(0,n.useRef)(null),{product:E,isLoading:h,isPendingAction:w,productVariation:N}=(0,i.useSelect)((e=>{const{getProduct:t,hasFinishedResolution:n,isPending:r,getPermalinkParts:c}=e(a.PRODUCTS_STORE_NAME),{hasFinishedResolution:i}=e(a.EXPERIMENTAL_PRODUCT_FORM_STORE_NAME),{getProductVariation:l,hasFinishedResolution:s}=e(a.EXPERIMENTAL_PRODUCT_VARIATIONS_STORE_NAME);if(o){const e=t(parseInt(o,10),void 0);return{product:c(parseInt(o,10))&&e?e:void 0,productVariation:p&&l({id:parseInt(u,10),product_id:parseInt(o,10)}),isLoading:!(n("getProduct",[parseInt(o,10)])&&n("getPermalinkParts",[parseInt(o,10)])&&p&&s("getProductVariation",[parseInt(u,10)])&&i("getProductForm")),isPendingAction:r("createProduct")||r("deleteProduct",parseInt(o,10))||r("updateProduct",parseInt(o,10))}}return{isLoading:!1,isPendingAction:!1}}));(0,n.useEffect)((()=>{_.current&&E&&_.current.id!==E.id&&g.current&&g.current.resetForm(E),_.current=E}),[E]),(0,n.useEffect)((()=>{(0,c.recordEvent)("view_new_product_management_experience")}),[]);const b=(null===(e=_.current)||void 0===e?void 0:e.id)===(null==E?void 0:E.id)&&"trash"!==(null===(t=_.current)||void 0===t?void 0:t.status)&&"trash"===(null==E?void 0:E.status);return(0,n.createElement)("div",{className:"woocommerce-edit-product"},h&&!E?(0,n.createElement)("div",{className:"woocommerce-edit-product__spinner"},(0,n.createElement)(l.Spinner,null)):null,E&&"trash"===E.status&&!w&&!b&&(0,n.createElement)(d.a,{id:"error"},(0,n.createElement)("div",{className:"woocommerce-edit-product__error"},(0,r.__)("You cannot edit this item because it is in the Trash. Please restore it and try again.","woocommerce"))),window.wcAdminFeatures["product-variation-management"]&&N&&E&&(0,n.createElement)(P,{product:E,productVariation:N}),!p&&E&&("trash"!==E.status||b)&&(0,n.createElement)(m.H,{formRef:g,product:E}))}},40033:(e,t,o)=>{var n=o(69307),r=o(98817),a=o(9818),c=o(67221),i=o(86020),l=o(51393);const s=e=>{let{fields:t}=e;const{getInputProps:o}=(0,i.useFormContext)();return(0,n.createElement)(n.Fragment,null,t.map((e=>(0,n.createElement)(l.__experimentalWooProductFieldItem,{key:e.properties.name,id:e.id,sections:[{name:e.section,order:e.order}],pluginId:e.plugin_id},(0,n.createElement)(n.Fragment,null,(0,i.renderField)(e.type,{...o(e.properties.name),...e.properties})))))," ")},m=e=>{let{sections:t}=e;return(0,n.createElement)(n.Fragment,null,t.map((e=>(0,n.createElement)(l.__experimentalWooProductSectionItem,{key:e.id,id:e.id,tabs:[{name:e.location,order:e.order}],pluginId:e.plugin_id},(0,n.createElement)(l.__experimentalProductFieldSection,{id:e.id,title:e.title,description:e.description})))))};(0,i.registerCoreProductFields)();const d=()=>{const{formData:e}=(0,a.useSelect)((e=>({formData:e(c.EXPERIMENTAL_PRODUCT_FORM_STORE_NAME).getProductForm()})));return(0,n.createElement)(n.Fragment,null,e&&(0,n.createElement)(n.Fragment,null,(0,n.createElement)(m,{sections:e.sections}),(0,n.createElement)(s,{fields:e.fields})))};(0,a.resolveSelect)(c.EXPERIMENTAL_PRODUCT_FORM_STORE_NAME).getProductForm(),(0,r.registerPlugin)("wc-admin-product-editor-api-form-fills",{scope:"woocommerce-product-editor",render:()=>(0,n.createElement)(d,null)});var u=o(65736);const p="tab/general",_="tab/pricing",g="tab/inventory",E="tab/shipping",h="variant/tab/pricing",w="variant/tab/inventory",N="variant/tab/shipping",b="tab/general/images",v="tab/general/attributes",I="woocommerce",C=()=>(0,n.createElement)(n.Fragment,null,(0,n.createElement)(l.__experimentalWooProductSectionItem,{id:l.DETAILS_SECTION_ID,tabs:[{name:l.TAB_GENERAL_ID,order:1}],pluginId:I},(0,n.createElement)(l.__experimentalProductFieldSection,{id:l.DETAILS_SECTION_ID,title:(0,u.__)("Product details","woocommerce"),description:(0,u.__)("This info will be displayed on the product page, category pages, social media, and search results.","woocommerce")})),(0,n.createElement)(l.__experimentalWooProductFieldItem,{id:"name",sections:[{name:l.DETAILS_SECTION_ID,order:1}],pluginId:I},(0,n.createElement)(l.__experimentalDetailsNameField,null)),(0,n.createElement)(l.__experimentalWooProductFieldItem,{id:"categories",sections:[{name:l.DETAILS_SECTION_ID,order:3}],pluginId:I},(0,n.createElement)(l.__experimentalDetailsCategoriesField,null)),(0,n.createElement)(l.__experimentalWooProductFieldItem,{id:"feature",sections:[{name:l.DETAILS_SECTION_ID,order:5}],pluginId:I},(0,n.createElement)(l.__experimentalDetailsFeatureField,null)),(0,n.createElement)(l.__experimentalWooProductFieldItem,{id:"summary",sections:[{name:l.DETAILS_SECTION_ID,order:7}],pluginId:I},(0,n.createElement)(l.__experimentalDetailsSummaryField,null)),(0,n.createElement)(l.__experimentalWooProductFieldItem,{id:"description",sections:[{name:l.DETAILS_SECTION_ID,order:9}],pluginId:I},(0,n.createElement)(l.__experimentalDetailsDescriptionField,null)));var f=o(5267),S=o(75283),x=o(14599),k=o(55609);const P="__ADD_NEW_SHIPPING_CLASS_OPTION__";var T=o(73463);const y=[{value:"",label:(0,u.__)("No shipping class","woocommerce")},{value:P,label:(0,u.__)("Add new shipping class","woocommerce")}];function M(e){return e.map((e=>{let{slug:t,name:o}=e;return{value:t,label:o}}))}function D(e,t){var o;const n=null==e||null===(o=e.categories)||void 0===o?void 0:o.find((e=>{let{slug:t}=e;return"uncategorized"!==t}));if(n&&(null==t||!t.some((e=>{let{slug:t}=e;return t===n.slug}))))return{name:n.name,slug:n.slug}}const F=e=>{let{product:t}=e;const{getInputProps:o,getSelectControlProps:r,setValue:s}=(0,i.useFormContext)(),[m,d]=(0,n.useState)(!1),p=o("shipping_class"),{shippingClasses:_,hasResolvedShippingClasses:g}=(0,a.useSelect)((e=>{const{getProductShippingClasses:t,hasFinishedResolution:o}=e(c.EXPERIMENTAL_PRODUCT_SHIPPING_CLASSES_STORE_NAME);return{hasResolvedShippingClasses:o("getProductShippingClasses"),shippingClasses:t()}}),[]),{createProductShippingClass:E,invalidateResolution:h}=(0,a.useDispatch)(c.EXPERIMENTAL_PRODUCT_SHIPPING_CLASSES_STORE_NAME),{createErrorNotice:w}=(0,a.useDispatch)("core/notices");function N(e){let t=(0,u.__)("We couldn’t add this shipping class. Try again in a few seconds.","woocommerce");throw"term_exists"===e.code&&(t=(0,u.__)("A shipping class with that slug already exists.","woocommerce")),w(t,{explicitDismiss:!0}),e}return(0,n.createElement)(n.Fragment,null,g?(0,n.createElement)(n.Fragment,null,(0,n.createElement)(k.SelectControl,(0,f.Z)({label:(0,u.__)("Shipping class","woocommerce")},r("shipping_class",{className:"half-width-field"}),{onChange:e=>{e!==P?p.onChange(e):d(!0)},options:[...y,...M(null!=_?_:[])]})),(0,n.createElement)("span",{className:"woocommerce-product-form__secondary-text"},(0,S.Z)({mixedString:(0,u.__)("Manage shipping classes and rates in {{link}}global settings{{/link}}.","woocommerce"),components:{link:(0,n.createElement)(i.Link,{href:`${T.SX}admin.php?page=wc-settings&tab=shipping&section=classes`,target:"_blank",type:"external",onClick:()=>{(0,x.recordEvent)("product_shipping_global_settings_link_click")}},(0,n.createElement)(n.Fragment,null))}}))):(0,n.createElement)("div",{className:"product-shipping-section__spinner-wrapper"},(0,n.createElement)(i.Spinner,null)),m&&(0,n.createElement)(l.AddNewShippingClassModal,{shippingClass:D(t,_),onAdd:e=>E(e).then((e=>((0,x.recordEvent)("product_new_shipping_class_modal_add_button_click"),h("getProductShippingClasses"),s("shipping_class",e.slug),e))).catch(N),onCancel:()=>d(!1)}))},O=e=>(0,S.Z)({mixedString:e,components:{span:(0,n.createElement)("span",{className:"woocommerce-product-form__secondary-text"})}}),A=e=>{let{dimensionProps:t,setHighlightSide:o}=e;const{getInputProps:r}=(0,i.useFormContext)(),{formatNumber:a}=(0,l.__experimentalUseProductHelper)(),c=r("dimensions.width",t);return(0,n.createElement)(k.BaseControl,{id:"product_shipping_dimensions_width",className:c.className,help:c.help},(0,n.createElement)(k.__experimentalInputControl,(0,f.Z)({},c,{value:a(String(c.value)),label:O((0,u.__)("Width {{span}}A{{/span}}","woocommerce")),onFocus:()=>{o("A")}})))},L=e=>{let{dimensionProps:t,setHighlightSide:o}=e;const{getInputProps:r}=(0,i.useFormContext)(),{formatNumber:a}=(0,l.__experimentalUseProductHelper)(),c=r("dimensions.length",t);return(0,n.createElement)(k.BaseControl,{id:"product_shipping_dimensions_length",className:c.className,help:c.help},(0,n.createElement)(k.__experimentalInputControl,(0,f.Z)({},c,{value:a(String(c.value)),label:O((0,u.__)("Length {{span}}B{{/span}}","woocommerce")),onFocus:()=>{o("B")}})))},R=e=>{let{dimensionProps:t,setHighlightSide:o}=e;const{getInputProps:r}=(0,i.useFormContext)(),{formatNumber:a}=(0,l.__experimentalUseProductHelper)(),c=r("dimensions.height",t);return(0,n.createElement)(k.BaseControl,{id:"product_shipping_dimensions_height",className:c.className,help:c.help},(0,n.createElement)(k.__experimentalInputControl,(0,f.Z)({},c,{value:a(String(c.value)),label:O((0,u.__)("Height {{span}}C{{/span}}","woocommerce")),onFocus:()=>{o("C")}})))},U=()=>{const{getInputProps:e}=(0,i.useFormContext)(),{formatNumber:t,parseNumber:o}=(0,l.__experimentalUseProductHelper)(),{weightUnit:r,hasResolvedUnits:s}=(0,a.useSelect)((e=>{const{getOption:t,hasFinishedResolution:o}=e(c.OPTIONS_STORE_NAME);return{weightUnit:t("woocommerce_weight_unit"),hasResolvedUnits:o("getOption",["woocommerce_weight_unit"])}}),[]);if(!s)return null;const m=e("weight",{sanitize:e=>o(String(e))});return(0,n.createElement)(k.BaseControl,{id:"product_shipping_weight",className:m.className,help:m.help},(0,n.createElement)(k.__experimentalInputControl,(0,f.Z)({},m,{value:t(String(m.value)),label:(0,u.__)("Weight","woocommerce"),suffix:r})))},j=e=>{let{basicSectionId:t,dimensionsSectionId:o,tabId:r}=e;const[i,s]=(0,n.useState)(),{parseNumber:m}=(0,l.__experimentalUseProductHelper)(),{dimensionUnit:d,hasResolvedUnits:p}=(0,a.useSelect)((e=>{const{getOption:t,hasFinishedResolution:o}=e(c.OPTIONS_STORE_NAME);return{dimensionUnit:t("woocommerce_dimension_unit"),weightUnit:t("woocommerce_weight_unit"),hasResolvedUnits:o("getOption",["woocommerce_dimension_unit"])&&o("getOption",["woocommerce_weight_unit"])}}),[]),_={onBlur:()=>{s(void 0)},sanitize:e=>m(String(e)),suffix:d};return(0,n.createElement)(n.Fragment,null,(0,n.createElement)(l.__experimentalWooProductSectionItem,{id:t,tabs:[{name:r,order:1}],pluginId:I},(0,n.createElement)(l.__experimentalProductSectionLayout,{title:(0,u.__)("Shipping","woocommerce"),description:(0,u.__)("Set up shipping costs and enter dimensions used for accurate rate calculations.","woocommerce")},(0,n.createElement)(k.Card,null,(0,n.createElement)(k.CardBody,{className:"product-shipping-section__classes"},(0,n.createElement)(l.__experimentalWooProductFieldItem.Slot,{section:t}))),(0,n.createElement)(k.Card,null,(0,n.createElement)(k.CardBody,{className:"product-shipping-section__dimensions"},(0,n.createElement)("h4",null,(0,u.__)("Dimensions","woocommerce")),(0,n.createElement)("p",{className:"woocommerce-product-form__secondary-text"},(0,u.__)("Enter the size of the product as you'd put it in a shipping box, including packaging like bubble wrap.","woocommerce")),(0,n.createElement)("div",{className:"product-shipping-section__dimensions-body"},(0,n.createElement)("div",{className:"product-shipping-section__dimensions-body-col"},p&&(0,n.createElement)(l.__experimentalWooProductFieldItem.Slot,{section:o,fillProps:{setHighlightSide:s,dimensionProps:_}})),(0,n.createElement)("div",{className:"product-shipping-section__dimensions-body-col"},(0,n.createElement)(l.__experimentalShippingDimensionsImage,{highlight:i,className:"product-shipping-section__dimensions-image"}))))))),(0,n.createElement)(l.__experimentalWooProductFieldItem,{id:"class",sections:[{name:t,order:1}],pluginId:I},(e=>{let{product:t}=e;return(0,n.createElement)(F,{product:t})})),(0,n.createElement)(l.__experimentalWooProductFieldItem,{id:"width",sections:[{name:o,order:1}],pluginId:I},(e=>{let{...t}=e;return(0,n.createElement)(A,t)})),(0,n.createElement)(l.__experimentalWooProductFieldItem,{id:"length",sections:[{name:o,order:3}],pluginId:I},(e=>{let{...t}=e;return(0,n.createElement)(L,t)})),(0,n.createElement)(l.__experimentalWooProductFieldItem,{id:"height",sections:[{name:o,order:5}],pluginId:I},(e=>{let{...t}=e;return(0,n.createElement)(R,t)})),(0,n.createElement)(l.__experimentalWooProductFieldItem,{id:"weight",sections:[{name:o,order:7}],pluginId:I},(0,n.createElement)(U,null)))};var z=o(17844);const W=e=>{var t;let{currencyInputProps:o}=e;const{getInputProps:r}=(0,i.useFormContext)(),s=(0,n.useContext)(z.CurrencyContext),{getCurrencyConfig:m,formatAmount:d}=s,p=m(),{isResolving:_,taxSettings:g}=(0,a.useSelect)((e=>{var t,o;const{getSettings:n,hasFinishedResolution:r}=e(c.SETTINGS_STORE_NAME);return{isResolving:!r("getSettings",["tax"]),taxSettings:n("tax").tax||{},taxesEnabled:"yes"===(null===(t=n("general"))||void 0===t||null===(o=t.general)||void 0===o?void 0:o.woocommerce_calc_taxes)}})),E=r("regular_price",o),h=(0,u.__)("Per your {{link}}store settings{{/link}}, tax is {{strong}}included{{/strong}} in the price.","woocommerce"),w=(0,u.__)("Per your {{link}}store settings{{/link}}, tax is {{strong}}not included{{/strong}} in the price.","woocommerce"),N="yes"===g.woocommerce_prices_include_tax,b=(0,S.Z)({mixedString:N?h:w,components:{link:(0,n.createElement)(i.Link,{href:`${T.SX}admin.php?page=wc-settings&tab=tax`,target:"_blank",type:"external",onClick:()=>{(0,x.recordEvent)("product_pricing_list_price_help_tax_settings_click")}},(0,n.createElement)(n.Fragment,null)),strong:(0,n.createElement)("strong",null)}});return(0,n.createElement)(n.Fragment,null,(0,n.createElement)(k.BaseControl,{id:"product_pricing_regular_price",help:null!==(t=null==E?void 0:E.help)&&void 0!==t?t:""},(0,n.createElement)(k.__experimentalInputControl,(0,f.Z)({},E,{name:"regular_price",label:(0,u.__)("List price","woocommerce"),value:(0,l.formatCurrencyDisplayValue)(String(null==E?void 0:E.value),p,d)}))),!_&&(0,n.createElement)("span",{className:"woocommerce-product-form__secondary-text"},b))};var Z=o(69771),H=o(76292),B=o.n(H);const Q=e=>{var t,o;let{currencyInputProps:r}=e;const{getInputProps:s,values:m,setValues:d}=(0,i.useFormContext)(),{dateFormat:p,timeFormat:_}=(0,a.useSelect)((e=>{const{getOption:t}=e(c.OPTIONS_STORE_NAME);return{dateFormat:t("date_format")||"F j, Y",timeFormat:t("time_format")||"H:i"}})),g=(0,n.useContext)(z.CurrencyContext),{getCurrencyConfig:E,formatAmount:h}=g,w=E(),[N,b]=(0,n.useState)(!1),[v,I]=(0,n.useState)(!1),[C,P]=(0,n.useState)(!1);(0,n.useEffect)((()=>{if(v||C)return;const e="string"==typeof m.date_on_sale_from_gmt&&m.date_on_sale_from_gmt.length>0,t="string"==typeof m.date_on_sale_to_gmt&&m.date_on_sale_to_gmt.length>0;(e||t)&&(P(!0),b(!0))}),[v,C,m]);const T=s("sale_price",r),y={className:"woocommerce-product__date-time-picker",isDateOnlyPicker:!0,dateTimeFormat:p};return(0,n.createElement)(n.Fragment,null,(0,n.createElement)(k.BaseControl,{id:"product_pricing_sale_price",help:null!==(t=null==T?void 0:T.help)&&void 0!==t?t:""},(0,n.createElement)(k.__experimentalInputControl,(0,f.Z)({},T,{name:"sale_price",label:(0,u.__)("Sale price","woocommerce"),value:(0,l.formatCurrencyDisplayValue)(String(null==T?void 0:T.value),w,h)}))),(0,n.createElement)(k.ToggleControl,{label:(0,n.createElement)(n.Fragment,null,(0,u.__)("Schedule sale","woocommerce"),(0,n.createElement)(i.__experimentalTooltip,{text:(0,S.Z)({mixedString:(0,u.__)('The sale will start at the beginning of the "From" date ({{startTime/}}) and expire at the end of the "To" date ({{endTime/}}). {{moreLink/}}',"woocommerce"),components:{startTime:(0,n.createElement)("span",null,(0,Z.format)(_,B()().startOf("day"))),endTime:(0,n.createElement)("span",null,(0,Z.format)(_,B()().endOf("day"))),moreLink:(0,n.createElement)(i.Link,{href:"https://woocommerce.com/document/managing-products/#product-data",target:"_blank",type:"external",onClick:()=>(0,x.recordEvent)("add_product_learn_more",{category:"product-scheduled-sale"})},(0,u.__)("Learn more","woocommerce"))}})})),checked:N,onChange:e=>{(0,x.recordEvent)("product_pricing_schedule_sale_toggle_click",{enabled:e}),I(!0),b(e),d(e?{date_on_sale_from_gmt:B()().startOf("day").toISOString(),date_on_sale_to_gmt:null}:{date_on_sale_from_gmt:null,date_on_sale_to_gmt:null})},disabled:!((null===(o=m.sale_price)||void 0===o?void 0:o.length)>0)}),N&&(0,n.createElement)(n.Fragment,null,(0,n.createElement)(i.DateTimePickerControl,(0,f.Z)({label:(0,u.__)("From","woocommerce"),placeholder:(0,u.__)("Now","woocommerce"),timeForDateOnly:"start-of-day",currentDate:m.date_on_sale_from_gmt},s("date_on_sale_from_gmt",{...y}))),(0,n.createElement)(i.DateTimePickerControl,(0,f.Z)({label:(0,u.__)("To","woocommerce"),placeholder:(0,u.__)("No end date","woocommerce"),timeForDateOnly:"end-of-day",currentDate:m.date_on_sale_to_gmt},s("date_on_sale_to_gmt",{...y})))))},Y=()=>{const{getInputProps:e}=(0,i.useFormContext)(),t=e("tax_status");return delete t.checked,delete t.value,(0,n.createElement)(k.RadioControl,(0,f.Z)({},t,{label:(0,u.__)("Charge sales tax on","woocommerce"),options:[{label:(0,u.__)("Product and shipping","woocommerce"),value:"taxable"},{label:(0,u.__)("Only shipping","woocommerce"),value:"shipping"},{label:(0,u.__)("Don't charge tax","woocommerce"),value:"none"}]}))},V=()=>{const{getInputProps:e}=(0,i.useFormContext)(),{isResolving:t,taxClasses:o}=(0,a.useSelect)((e=>{const{hasFinishedResolution:t,getTaxClasses:o}=e(c.EXPERIMENTAL_TAX_CLASSES_STORE_NAME);return{isResolving:!t("getTaxClasses"),taxClasses:o()}})),r=e("tax_class");return delete r.checked,delete r.value,t||o.length<=0?null:(0,n.createElement)(k.RadioControl,(0,f.Z)({},r,{label:(0,n.createElement)(n.Fragment,null,(0,n.createElement)("span",null,(0,u.__)("Tax class","woocommerce")),(0,n.createElement)("span",{className:"woocommerce-product-form__secondary-text"},(0,S.Z)({mixedString:(0,u.__)("Apply a tax rate if this product qualifies for tax reduction or exemption. {{link}}Learn more{{/link}}","woocommerce"),components:{link:(0,n.createElement)(i.Link,{href:"https://woocommerce.com/document/setting-up-taxes-in-woocommerce/#shipping-tax-class",target:"_blank",type:"external"},(0,n.createElement)(n.Fragment,null))}}))),options:o.map((e=>({label:e.name,value:"standard"===e.slug?"":e.slug})))}))},G=e=>{let{tabId:t,basicSectionId:o,taxesSectionId:r,taxesAdvancedSectionId:a}=e;const{setValues:c,values:s}=(0,i.useFormContext)(),{sanitizePrice:m}=(0,l.__experimentalUseProductHelper)(),d=(0,n.useContext)(z.CurrencyContext),{getCurrencyConfig:p}=d,_={prefix:p().symbol,className:"half-width-field components-currency-control",sanitize:e=>m(String(e)),onFocus(e){setTimeout((function(e){e.select()}),0,e.currentTarget)},onKeyUp(e){const t=e.currentTarget.name,o=Number.parseFloat(m(s[t]||"0")),n=Number(e.currentTarget.step||"1");"ArrowUp"===e.code&&c({[t]:String(o+n)}),"ArrowDown"===e.code&&c({[t]:String(o-n)})}};return(0,n.createElement)(n.Fragment,null,(0,n.createElement)(l.__experimentalWooProductSectionItem,{id:o,tabs:[{name:t,order:1}],pluginId:I},(0,n.createElement)(l.__experimentalProductSectionLayout,{title:(0,u.__)("Pricing","woocommerce"),description:(0,n.createElement)(n.Fragment,null,(0,n.createElement)("span",null,(0,u.__)("Set a competitive price, put the product on sale, and manage tax calculations.","woocommerce")),(0,n.createElement)(i.Link,{className:"woocommerce-form-section__header-link",href:"https://woocommerce.com/posts/how-to-price-products-strategies-expert-tips/",target:"_blank",type:"external",onClick:()=>{(0,x.recordEvent)("add_product_pricing_help")}},(0,u.__)("How to price your product: expert tips","woocommerce")))},(0,n.createElement)(k.Card,null,(0,n.createElement)(k.CardBody,null,(0,n.createElement)(l.__experimentalWooProductFieldItem.Slot,{section:o}))),(0,n.createElement)(k.Card,null,(0,n.createElement)(k.CardBody,null,(0,n.createElement)(l.__experimentalWooProductFieldItem.Slot,{section:r}),(0,n.createElement)(i.CollapsibleContent,{toggleText:(0,u.__)("Advanced","woocommerce")},(0,n.createElement)(l.__experimentalWooProductFieldItem.Slot,{section:a})))))),(0,n.createElement)(l.__experimentalWooProductFieldItem,{id:"list",sections:[{name:o,order:1}],pluginId:I},(0,n.createElement)(W,{currencyInputProps:_})),(0,n.createElement)(l.__experimentalWooProductFieldItem,{id:"sale",sections:[{name:o,order:3}],pluginId:I},(0,n.createElement)(Q,{currencyInputProps:_})),(0,n.createElement)(l.__experimentalWooProductFieldItem,{id:"charge",sections:[{name:r,order:1}],pluginId:I},(0,n.createElement)(Y,null)),(0,n.createElement)(l.__experimentalWooProductFieldItem,{id:"class",sections:[{name:a,order:3}],pluginId:I},(0,n.createElement)(V,null)))},q=()=>{const{getInputProps:e}=(0,i.useFormContext)();return(0,n.createElement)(k.TextControl,(0,f.Z)({label:(0,u.__)("SKU (Stock Keeping Unit)","woocommerce")},e("sku",{className:"half-width-field"})))},X=()=>{const{getCheckboxControlProps:e}=(0,i.useFormContext)(),t="yes"===(0,T.O3)("manageStock","yes");return(0,n.createElement)(i.__experimentalConditionalWrapper,{condition:!t,wrapper:e=>(0,n.createElement)(k.Tooltip,{text:(0,u.__)("Quantity tracking is disabled for all products. Go to global store settings to change it.","woocommerce"),position:"top center"},(0,n.createElement)("div",{className:"woocommerce-product-form__tooltip-disabled-overlay"},e))},(0,n.createElement)(k.ToggleControl,(0,f.Z)({label:(0,u.__)("Track quantity for this product","woocommerce")},e("manage_stock",(0,l.getCheckboxTracks)("manage_stock")),{disabled:!t})))},K=()=>{const{getInputProps:e}=(0,i.useFormContext)(),t=e("stock_status");return delete t.checked,delete t.value,(0,n.createElement)(k.RadioControl,(0,f.Z)({label:(0,u.__)("Stock status","woocommerce"),options:[{label:(0,u.__)("In stock","woocommerce"),value:"instock"},{label:(0,u.__)("Out of stock","woocommerce"),value:"outofstock"},{label:(0,u.__)("On backorder","woocommerce"),value:"onbackorder"}]},t))};var $=o(74617);const J=()=>{const{getInputProps:e}=(0,i.useFormContext)(),t=(0,T.O3)("notifyLowStockAmount",2);return(0,n.createElement)(n.Fragment,null,(0,n.createElement)("h4",null,(0,u.__)("Product quantity","woocommerce")),(0,n.createElement)(k.TextControl,(0,f.Z)({type:"number",label:(0,u.__)("Current quantity","woocommerce")},e("stock_quantity"),{min:0})),(0,n.createElement)(k.TextControl,(0,f.Z)({type:"number",label:(0,u.__)("Email me when quantity reaches","woocommerce"),placeholder:(0,u.sprintf)((0,u.__)("%d (store default)","woocommerce"),t)},e("low_stock_amount"),{min:0})),(0,n.createElement)("span",{className:"woocommerce-product-form__secondary-text"},(0,S.Z)({mixedString:(0,u.__)("Make sure to enable notifications in {{link}}store settings{{/link}}.","woocommerce"),components:{link:(0,n.createElement)(i.Link,{href:(0,$.getAdminLink)("admin.php?page=wc-settings&tab=products&section=inventory"),target:"_blank",type:"wp-admin",onClick:()=>{(0,x.recordEvent)("product_pricing_list_price_help_tax_settings_click")}},(0,n.createElement)(n.Fragment,null)),strong:(0,n.createElement)("strong",null)}})))},ee=()=>{const{getInputProps:e}=(0,i.useFormContext)(),t=e("backorders");return delete t.checked,delete t.value,(0,n.createElement)(k.RadioControl,(0,f.Z)({label:(0,u.__)("When out of stock","woocommerce"),options:[{label:(0,u.__)("Allow purchases","woocommerce"),value:"yes"},{label:(0,u.__)("Allow purchases, but notify customers","woocommerce"),value:"notify"},{label:(0,u.__)("Don't allow purchases","woocommerce"),value:"no"}]},t))},te=()=>{const{getCheckboxControlProps:e}=(0,i.useFormContext)();return(0,n.createElement)(n.Fragment,null,(0,n.createElement)("h4",null,(0,u.__)("Restrictions","woocommerce")),(0,n.createElement)(k.CheckboxControl,(0,f.Z)({label:(0,u.__)("Limit purchases to 1 item per order","woocommerce")},e("sold_individually",(0,l.getCheckboxTracks)("sold_individually")))))},oe=e=>{let{tabId:t,basicSectionId:o,advancedSectionId:r}=e;const{values:a}=(0,i.useFormContext)();return(0,n.createElement)(n.Fragment,null,(0,n.createElement)(l.__experimentalWooProductSectionItem,{id:o,tabs:[{name:t,order:1}],pluginId:I},(0,n.createElement)(l.__experimentalProductSectionLayout,{title:(0,u.__)("Inventory","woocommerce"),description:(0,n.createElement)(n.Fragment,null,(0,n.createElement)("span",null,(0,u.__)("Set up and manage inventory for this product, including status and available quantity.","woocommerce")),(0,n.createElement)(i.Link,{href:(0,$.getAdminLink)("admin.php?page=wc-settings&tab=products&section=inventory"),target:"_blank",type:"wp-admin",onClick:()=>{(0,x.recordEvent)("add_product_inventory_help")},className:"woocommerce-form-section__header-link"},(0,u.__)("Manage global inventory settings","woocommerce")))},(0,n.createElement)(k.Card,null,(0,n.createElement)(k.CardBody,null,(0,n.createElement)(l.__experimentalWooProductFieldItem.Slot,{section:o}),(0,n.createElement)(i.CollapsibleContent,{toggleText:(0,u.__)("Advanced","woocommerce")},(0,n.createElement)(l.__experimentalWooProductFieldItem.Slot,{section:r})))))),(0,n.createElement)(l.__experimentalWooProductFieldItem,{id:"sku",sections:[{name:o,order:1}],pluginId:I},(0,n.createElement)(q,null)),(0,n.createElement)(l.__experimentalWooProductFieldItem,{id:"track-quantity",sections:[{name:o,order:3}],pluginId:I},(0,n.createElement)(X,null)),a.manage_stock?(0,n.createElement)(l.__experimentalWooProductFieldItem,{id:"stock-manage",sections:[{name:o,order:5}],pluginId:I},(0,n.createElement)(J,null)):(0,n.createElement)(l.__experimentalWooProductFieldItem,{id:"stock-manual",sections:[{name:o,order:5}],pluginId:I},(0,n.createElement)(K,null)),a.manage_stock&&(0,n.createElement)(l.__experimentalWooProductFieldItem,{id:"stock-out",sections:[{name:r,order:1}],pluginId:I},(0,n.createElement)(ee,null)),(0,n.createElement)(l.__experimentalWooProductFieldItem,{id:"stock-limit",sections:[{name:r,order:3}],pluginId:I},(0,n.createElement)(te,null)))},ne=()=>{const{getInputProps:e,values:{id:t}}=(0,i.useFormContext)();return(0,n.createElement)(l.__experimentalAttributes,e("attributes",{productId:t}))},re=()=>(0,n.createElement)(n.Fragment,null,(0,n.createElement)(l.__experimentalWooProductSectionItem,{id:v,tabs:[{name:p,order:5}],pluginId:I},(0,n.createElement)(l.__experimentalProductSectionLayout,{title:(0,u.__)("Attributes","woocommerce"),className:"woocommerce-product-attributes-section",description:(0,n.createElement)(n.Fragment,null,(0,n.createElement)("span",null,(0,u.__)("Add descriptive pieces of information that customers can use to filter and search for this product.","woocommerce")),(0,n.createElement)(i.Link,{className:"woocommerce-form-section__header-link",href:"https://woocommerce.com/document/managing-product-taxonomies/#product-attributes",target:"_blank",type:"external",onClick:()=>{(0,x.recordEvent)("learn_more_about_attributes_help")}},(0,u.__)("Learn more about attributes","woocommerce")))},(0,n.createElement)(l.__experimentalWooProductFieldItem.Slot,{section:v}))),(0,n.createElement)(l.__experimentalWooProductFieldItem,{id:"add",sections:[{name:v,order:1}],pluginId:I},(0,n.createElement)(ne,null)));var ae=o(23374),ce=o(19944),ie=o(83849),le=o.n(ie),se=o(34537);const me=()=>{const{getInputProps:e,setValue:t}=(0,i.useFormContext)(),o=e("images").value||[],[r,a]=(0,n.useState)(!1),[c,l]=(0,n.useState)(!1),[s,m]=(0,n.useState)(null),d=()=>{a(!r)};return(0,n.createElement)("div",{className:le()("woocommerce-product-form__images",{"has-images":o.length>0})},(0,n.createElement)(i.ImageGallery,{onDragStart:e=>{const{id:t,dataset:n}=e.target;if(t)m(parseInt(t,10));else{const e=null==n?void 0:n.index;var r;e&&m(null===(r=o[parseInt(e,10)])||void 0===r?void 0:r.id)}d()},onDragEnd:()=>{c&&s&&((0,x.recordEvent)("product_images_remove_image_button_click"),t("images",o.filter((e=>e.id!==s))),l(!1),m(null)),d()},onOrderChange:e=>{const n=e.map((e=>o.find((t=>{var o;return t.id===parseInt(null==e||null===(o=e.props)||void 0===o?void 0:o.id,10)}))));(0,x.recordEvent)("product_images_change_image_order_via_image_gallery"),t("images",n)},onReplace:e=>{let{replaceIndex:n,media:r}=e;void 0===o.find((e=>r.id===e.id))&&(o[n]=r,(0,x.recordEvent)("product_images_replace_image_button_click"),t("images",o))},onSelectAsCover:()=>(0,x.recordEvent)("product_images_select_image_as_cover_button_click")},o.map((e=>(0,n.createElement)(i.ImageGalleryItem,{key:e.id||e.url,alt:e.alt,src:e.url||e.src,id:`${e.id}`})))),(0,n.createElement)("div",{className:"woocommerce-product-form__image-drop-zone"},r?(0,n.createElement)(k.CardBody,null,(0,n.createElement)("div",{className:"woocommerce-product-form__remove-image-drop-zone"},(0,n.createElement)("span",null,(0,n.createElement)(ae.Z,{icon:ce.Z,size:20,className:"icon-control"}),(0,u.__)("Drop here to remove","woocommerce")),(0,n.createElement)(k.DropZone,{onHTMLDrop:()=>l(!0),onDrop:()=>l(!0),label:(0,u.__)("Drop here to remove","woocommerce")}))):(0,n.createElement)(k.CardBody,null,(0,n.createElement)(i.MediaUploader,{multipleSelect:!0,onError:()=>null,onFileUploadChange:e=>{e[0].id&&((0,x.recordEvent)("product_images_add_via_file_upload_area"),t("images",[...o,...e]))},onSelect:e=>{const n=e.filter((e=>!o.find((t=>t.id===e.id))));n.length>0&&((0,x.recordEvent)("product_images_add_via_media_library"),t("images",[...o,...n]))},onUpload:e=>{e[0].id&&((0,x.recordEvent)("product_images_add_via_drag_and_drop_upload"),t("images",[...o,...e]))},label:(0,n.createElement)(n.Fragment,null,(0,n.createElement)("img",{src:se,alt:(0,u.__)("Completed","woocommerce"),className:"woocommerce-product-form__drag-and-drop-image"}),(0,n.createElement)("span",null,(0,u.__)("Drag images here or click to upload","woocommerce")))}))))},de=()=>(0,n.createElement)(n.Fragment,null,(0,n.createElement)(l.__experimentalWooProductSectionItem,{id:b,tabs:[{name:p,order:3}],pluginId:I},(0,n.createElement)(l.__experimentalProductFieldSection,{id:b,title:(0,u.__)("Images","woocommerce"),description:(0,n.createElement)(n.Fragment,null,(0,n.createElement)("span",null,(0,u.__)("For best results, use JPEG files that are 1000 by 1000 pixels or larger.","woocommerce")),(0,n.createElement)(i.Link,{className:"woocommerce-form-section__header-link",href:"https://woocommerce.com/posts/fast-high-quality-product-photos/",target:"_blank",type:"external",onClick:()=>{(0,x.recordEvent)("prepare_images_help")}},(0,u.__)("How should I prepare images?","woocommerce")))})),(0,n.createElement)(l.__experimentalWooProductFieldItem,{id:"gallery",sections:[{name:b,order:1}],pluginId:I},(0,n.createElement)(me,null))),ue=e=>{let{title:t,description:o,className:r,children:a}=e;return(0,n.createElement)(i.FormSection,{title:t,description:o,className:r},n.Children.map(a,(e=>(0,n.isValidElement)(e)&&e.props.onChange?(0,n.createElement)("div",{className:"product-field-layout"},e):e)))};var pe=o(10431),_e=o(56519),ge=o.n(_e);function Ee(e){let{width:t=24,height:o=24,...r}=e;return(0,n.createElement)("svg",(0,f.Z)({},r,{width:t,height:o,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"}),(0,n.createElement)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M13.7226 6.2125C13.1641 6.0766 12.5883 6 11.9999 6C8.10055 6 4.75407 9.36447 3.31899 11.0546C2.8507 11.6061 2.8507 12.3939 3.31899 12.9454C4.17896 13.9582 5.72533 15.5723 7.66574 16.7033L8.41572 15.4043C8.13761 15.242 7.86389 15.0655 7.59553 14.8776C6.25019 13.9359 5.15775 12.7905 4.48406 12C5.15775 11.2095 6.25019 10.0641 7.59553 9.12235C8.96667 8.16257 10.4775 7.5 11.9999 7.5C12.3118 7.5 12.6231 7.5278 12.9329 7.58027L13.7226 6.2125ZM12.3504 8.58923C12.2352 8.57753 12.1182 8.57153 11.9999 8.57153C10.1063 8.57153 8.57132 10.1066 8.57132 12.0001C8.57132 12.7505 8.81237 13.4445 9.22126 14.0091L10.1233 12.4467C10.0893 12.3034 10.0713 12.1538 10.0713 12.0001C10.0713 11.1266 10.652 10.3888 11.4484 10.1515L12.3504 8.58923ZM12.8092 10.2491L13.5611 8.94679C14.6697 9.51479 15.4285 10.6688 15.4285 12.0001C15.4285 13.8937 13.8934 15.4287 11.9999 15.4287C11.3128 15.4287 10.6729 15.2266 10.1364 14.8785L10.8883 13.5763C11.2025 13.7983 11.5859 13.9287 11.9999 13.9287C13.065 13.9287 13.9285 13.0652 13.9285 12.0001C13.9285 11.224 13.4701 10.555 12.8092 10.2491ZM9.51376 15.957C10.3246 16.2986 11.1605 16.5 11.9999 16.5C13.5223 16.5 15.0331 15.8374 16.4043 14.8776C17.7496 13.9359 18.842 12.7905 19.5157 12C18.842 11.2095 17.7496 10.0641 16.4043 9.12235C15.6875 8.62066 14.9327 8.20018 14.1579 7.91308L14.917 6.59839C17.5164 7.64275 19.6204 9.80575 20.6808 11.0546C21.1491 11.6061 21.1491 12.3939 20.6808 12.9454C19.2457 14.6355 15.8992 18 11.9999 18C10.8611 18 9.76945 17.713 8.7588 17.2646L9.51376 15.957Z",fill:"currentColor"}),(0,n.createElement)("rect",{x:"16.0625",y:"4.61377",width:"1.22727",height:"16",transform:"rotate(30 16.0625 4.61377)",fill:"currentColor"}))}function he(e){let{width:t=24,height:o=24,...r}=e;return(0,n.createElement)("svg",(0,f.Z)({},r,{width:t,height:o,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true"}),(0,n.createElement)("path",{d:"M20.1091 11.54C20.3396 11.8116 20.3396 12.1884 20.1091 12.46C19.4144 13.2781 18.266 14.4899 16.8343 15.4921C15.397 16.4982 13.7359 17.25 11.9999 17.25C10.2638 17.25 8.60268 16.4982 7.1654 15.4921C5.73376 14.4899 4.58533 13.2781 3.89066 12.46C3.6601 12.1884 3.6601 11.8116 3.89066 11.54C4.58533 10.7219 5.73376 9.51006 7.1654 8.50792C8.60268 7.50184 10.2638 6.75 11.9999 6.75C13.7359 6.75 15.397 7.50184 16.8343 8.50792C18.266 9.51006 19.4144 10.7219 20.1091 11.54Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinejoin:"round"}),(0,n.createElement)("circle",{cx:"11.9999",cy:"11.9999",r:"2.67857",stroke:"currentColor",strokeWidth:"1.5"}))}const we=(0,u.__)("Not visible to customers","woocommerce"),Ne=(0,u.__)("Visible to customers","woocommerce"),be=(0,u.__)("Updating product variation","woocommerce"),ve=()=>{const[e,t]=(0,n.useState)(1),[o,r]=(0,n.useState)(25),[s,m]=(0,n.useState)({}),{values:d}=(0,i.useFormContext)(),p=d.id,_=(0,n.useContext)(z.CurrencyContext),{formatAmount:g,getCurrencyConfig:E}=_,{isLoading:h,variations:w,totalCount:N}=(0,a.useSelect)((t=>{const{getProductVariations:n,hasFinishedResolution:r,getProductVariationsTotalCount:a}=t(c.EXPERIMENTAL_PRODUCT_VARIATIONS_STORE_NAME),i={product_id:p,page:e,per_page:o,order:"asc",orderby:"menu_order"};return{isLoading:!r("getProductVariations",[i]),variations:n(i),totalCount:a(i)}}),[e,o,p]),{updateProductVariation:b}=(0,a.useDispatch)(c.EXPERIMENTAL_PRODUCT_VARIATIONS_STORE_NAME),{sortedVariations:v,getVariationKey:I,onOrderChange:C}=(0,l.__experimentalUseVariationsOrder)({variations:w,currentPage:e});if(!w||h)return(0,n.createElement)(k.Card,{className:"woocommerce-product-variations is-loading"},(0,n.createElement)(k.Spinner,null));const f=E();function S(e,t){s[e]||(m((t=>({...t,[e]:!0}))),b({product_id:p,id:e},{status:t}).finally((()=>m((t=>({...t,[e]:!1}))))))}return(0,n.createElement)(k.Card,{className:"woocommerce-product-variations"},(0,n.createElement)("div",{className:"woocommerce-product-variations__header"},(0,n.createElement)("h4",null,(0,u.__)("Variation","woocommerce")),(0,n.createElement)("h4",null,(0,u.sprintf)((0,u.__)("Price (%s)","woocommerce"),f.code)),(0,n.createElement)("h4",null,(0,u.__)("Quantity","woocommerce"))),(0,n.createElement)(i.Sortable,{onOrderChange:C},v.map((e=>(0,n.createElement)(i.ListItem,{key:I(e)},(0,n.createElement)("div",{className:"woocommerce-product-variations__attributes"},e.attributes.map((e=>{const t=(0,n.createElement)(i.Tag,{id:e.id,className:"woocommerce-product-variations__attribute",key:e.id,label:ge()(e.option,{length:32}),screenReaderLabel:e.option});return e.option.length<=32?t:(0,n.createElement)(k.Tooltip,{key:e.id,text:e.option,position:"top center"},(0,n.createElement)("span",null,t))}))),(0,n.createElement)("div",{className:le()("woocommerce-product-variations__price",{"woocommerce-product-variations__price--fade":"private"===e.status})},g(e.price)),(0,n.createElement)("div",{className:le()("woocommerce-product-variations__quantity",{"woocommerce-product-variations__quantity--fade":"private"===e.status})},(0,n.createElement)("span",{className:le()("woocommerce-product-variations__status-dot",(0,l.getProductStockStatusClass)(e))},"●"),(0,l.getProductStockStatus)(e)),(0,n.createElement)("div",{className:"woocommerce-product-variations__actions"},(0,n.createElement)(i.Link,{href:(0,pe.getNewPath)({},`/product/${p}/variation/${e.id}`,{}),type:"wc-admin",className:"components-button"},(0,u.__)("Edit","woocommerce")),"private"===e.status&&(0,n.createElement)(k.Tooltip,{position:"top center",text:we},(0,n.createElement)(k.Button,{className:"components-button--hidden","aria-label":s[e.id]?be:we,"aria-disabled":s[e.id],onClick:()=>S(e.id,"publish")},s[e.id]?(0,n.createElement)(k.Spinner,null):(0,n.createElement)(Ee,null))),"publish"===e.status&&(0,n.createElement)(k.Tooltip,{position:"top center",text:Ne},(0,n.createElement)(k.Button,{className:"components-button--visible","aria-label":s[e.id]?be:Ne,"aria-disabled":s[e.id],onClick:()=>S(e.id,"private")},s[e.id]?(0,n.createElement)(k.Spinner,null):(0,n.createElement)(he,null)))))))),(0,n.createElement)(i.Pagination,{className:"woocommerce-product-variations__footer",page:e,perPage:o,total:N,showPagePicker:!1,onPageChange:t,onPerPageChange:r}))},Ie=()=>{const{getInputProps:e,values:{id:t}}=(0,i.useFormContext)(),{value:o}=e("attributes",{productId:t});return 0===(o?o.filter((e=>e.variation)):[]).length?null:(0,n.createElement)(ue,{title:(0,u.__)("Variations","woocommerce"),description:(0,n.createElement)(n.Fragment,null,(0,n.createElement)("span",null,(0,u.__)("Manage individual product combinations created from options.","woocommerce")),(0,n.createElement)(i.Link,{className:"woocommerce-form-section__header-link",href:"https://woocommerce.com/posts/product-variations-display/",target:"_blank",type:"external",onClick:()=>{(0,x.recordEvent)("add_product_variation_help")}},(0,u.__)("How to make variations work for you","woocommerce")))},(0,n.createElement)(ve,null))},Ce=()=>{const{values:e}=(0,i.useFormContext)(),t=(0,n.useMemo)((()=>{var t,o,n;return{general:{name:"general",title:(0,u.__)("General","woocommerce")},pricing:{name:"pricing",title:(0,u.__)("Pricing","woocommerce"),disabled:!(null==e||null===(t=e.variations)||void 0===t||!t.length)},inventory:{name:"inventory",title:(0,u.__)("Inventory","woocommerce"),disabled:!(null==e||null===(o=e.variations)||void 0===o||!o.length)},shipping:{name:"shipping",title:(0,u.__)("Shipping","woocommerce"),disabled:!(null==e||null===(n=e.variations)||void 0===n||!n.length)},options:{name:"options",title:(0,u.__)("Options","woocommerce")}}}),[e.variations]);return(0,n.createElement)(n.Fragment,null,(0,n.createElement)(l.__experimentalWooProductTabItem,{id:p,templates:[{name:p,order:1}],pluginId:I,tabProps:t.general},(0,n.createElement)(l.__experimentalWooProductSectionItem.Slot,{tab:p})),(0,n.createElement)(l.__experimentalWooProductTabItem,{id:_,templates:[{name:p,order:3}],pluginId:I,tabProps:t.pricing},(0,n.createElement)(l.__experimentalWooProductSectionItem.Slot,{tab:_})),(0,n.createElement)(l.__experimentalWooProductTabItem,{id:g,templates:[{name:p,order:5}],pluginId:I,tabProps:t.inventory},(0,n.createElement)(l.__experimentalWooProductSectionItem.Slot,{tab:g})),(0,n.createElement)(l.__experimentalWooProductTabItem,{id:E,templates:[{name:p,order:7}],pluginId:I,tabProps:t.shipping},(0,n.createElement)(l.__experimentalWooProductSectionItem.Slot,{tab:E,fillProps:{product:e}})),window.wcAdminFeatures["product-variation-management"]?(0,n.createElement)(l.__experimentalWooProductTabItem,{id:"tab/options",templates:[{name:p,order:9}],pluginId:I,tabProps:t.options},(0,n.createElement)(n.Fragment,null,(0,n.createElement)(Ie,null))):null)};(0,r.registerPlugin)("wc-admin-product-editor-form-fills",{scope:"woocommerce-product-editor",render:()=>(0,n.createElement)(n.Fragment,null,(0,n.createElement)(Ce,null),(0,n.createElement)(C,null),(0,n.createElement)(de,null),(0,n.createElement)(re,null),(0,n.createElement)(j,{tabId:E,basicSectionId:"tab/shipping/basic",dimensionsSectionId:"tab/shipping/dimensions"}),(0,n.createElement)(G,{tabId:_,basicSectionId:"tab/pricing/basic",taxesSectionId:"tab/pricing/taxes",taxesAdvancedSectionId:"tab/pricing/taxes/advanced"}),(0,n.createElement)(oe,{tabId:g,basicSectionId:"tab/inventory/basic",advancedSectionId:"tab/inventory/advanced"}))});var fe=o(4981),Se=o(61422),xe=o.n(Se);function ke(e){let{id:t,label:o,value:r,className:a,onChange:c,...l}=e;const s=null!=t?t:xe()();function m(e){"function"==typeof c&&c(e)}return(0,n.createElement)("div",(0,f.Z)({},l,{className:le()("woocommerce-single-image-field",a)}),(0,n.createElement)("label",{htmlFor:s,className:"components-base-control__label woocommerce-single-image-field__label"},o),r?(0,n.createElement)("div",{id:s,className:"woocommerce-single-image-field__gallery",tabIndex:-1,role:"region"},(0,n.createElement)(i.ImageGallery,{onReplace:e=>{let{media:t}=e;return m(t)},onRemove:()=>m(void 0)},(0,n.createElement)(i.ImageGalleryItem,{key:r.id,id:String(r.id),alt:r.alt,src:r.url}))):(0,n.createElement)("div",{id:s,className:"woocommerce-single-image-field__drop-zone",tabIndex:-1,role:"region"},(0,n.createElement)(i.MediaUploader,{onError:()=>null,onSelect:e=>m(e),onUpload:e=>{let[t]=e;return m(t)},onFileUploadChange:e=>{let[t]=e;return m(t)},label:(0,u.__)("Drag image here or click to upload","woocommerce"),buttonText:(0,u.__)("Choose image","woocommerce")})))}function Pe(e){if(e)return{id:e.id,url:e.src,alt:e.alt,title:e.name}}const Te=()=>{const{getCheckboxControlProps:e,getInputProps:t,values:o,setValue:r}=(0,i.useFormContext)(),[a,c]=(0,n.useState)((0,fe.rawHandler)({HTML:o.description})),s=t("image");return(0,n.createElement)(ue,{title:(0,u.__)("Variant details","woocommerce"),description:(0,u.__)("This info will be displayed on the product page, category pages, social media, and search results.","woocommerce")},(0,n.createElement)(k.Card,null,(0,n.createElement)(k.CardBody,null,(0,n.createElement)(k.CheckboxControl,(0,f.Z)({label:(0,n.createElement)(n.Fragment,null,(0,u.__)("Visible to customers","woocommerce"),(0,n.createElement)(i.__experimentalTooltip,{text:(0,u.__)("When enabled, customers will be able to select and purchase this variation from the product page.","woocommerce")}))},e("status",(0,l.getCheckboxTracks)("status")),{checked:"publish"===o.status,onChange:()=>r("status","publish"!==o.status?"publish":"private")})),(0,n.createElement)(i.__experimentalRichTextEditor,{label:(0,u.__)("Description","woocommerce"),blocks:a,onChange:e=>{c(e),a.length&&r("description",(0,fe.serialize)(e))},placeholder:(0,u.__)("Describe this product. What makes it unique? What are its most important features?","woocommerce")}),(0,n.createElement)(k.BaseControl,{id:"product-variation-image"},(0,n.createElement)(ke,{label:(0,u.__)("Image","woocommerce"),value:Pe(s.value),onChange:e=>r("image",function(e){if(e)return{id:e.id,src:e.url,alt:e.alt,name:e.title}}(e))})))))},ye={general:{name:"general",title:(0,u.__)("General","woocommerce")},pricing:{name:"pricing",title:(0,u.__)("Pricing","woocommerce")},inventory:{name:"inventory",title:(0,u.__)("Inventory","woocommerce")},shipping:{name:"shipping",title:(0,u.__)("Shipping","woocommerce")},options:{name:"options",title:(0,u.__)("Options","woocommerce")}},Me=()=>(0,n.createElement)(n.Fragment,null,(0,n.createElement)(l.__experimentalWooProductTabItem,{id:"variant/tab/general",templates:[{name:"tab/variation",order:1}],pluginId:I,tabProps:ye.general},(0,n.createElement)(Te,null)),(0,n.createElement)(l.__experimentalWooProductTabItem,{id:h,templates:[{name:"tab/variation",order:3}],pluginId:I,tabProps:ye.pricing},(0,n.createElement)(l.__experimentalWooProductSectionItem.Slot,{tab:h})),(0,n.createElement)(l.__experimentalWooProductTabItem,{id:w,templates:[{name:"tab/variation",order:5}],pluginId:I,tabProps:ye.inventory},(0,n.createElement)(l.__experimentalWooProductSectionItem.Slot,{tab:w})),(0,n.createElement)(l.__experimentalWooProductTabItem,{id:N,templates:[{name:"tab/variation",order:7}],pluginId:I,tabProps:ye.shipping},(e=>{let{product:t}=e;return(0,n.createElement)(l.__experimentalWooProductSectionItem.Slot,{tab:N,fillProps:{product:t}})})));(0,r.registerPlugin)("wc-admin-product-editor-form-variation-fills",{scope:"woocommerce-product-editor",render:()=>(0,n.createElement)(n.Fragment,null,(0,n.createElement)(Me,null),(0,n.createElement)(j,{tabId:N,basicSectionId:"variant/tab/shipping/basic",dimensionsSectionId:"variant/tab/shipping/dimensions"}),(0,n.createElement)(G,{tabId:h,basicSectionId:"variant/tab/pricing/basic",taxesSectionId:"variant/tab/pricing/taxes",taxesAdvancedSectionId:"variant/tab/pricing/taxes/advanced"}),(0,n.createElement)(oe,{tabId:w,basicSectionId:"variant/tab/inventory/basic",advancedSectionId:"variant/tab/inventory/advanced"}))})},56159:(e,t,o)=>{o.d(t,{_$:()=>b,U_:()=>g,b:()=>d});var n=o(69307),r=o(65736),a=o(55609),c=o(9818),i=o(75606),l=o(46530),s=o(51393),m=o(74693);const d=e=>{let{onClick:t}=e;const{showCesModal:o}=(0,c.useDispatch)(i.STORE_KEY),{isDescendantOf:d}=(0,l.useLayoutContext)();return(0,n.createElement)(a.MenuItem,{onClick:()=>{o({action:"new_product",showDescription:!1,title:(0,r.__)("What do you think of the new product form?","woocommerce"),firstQuestion:(0,r.__)("The product editing screen is easy to use","woocommerce"),secondQuestion:(0,r.__)("The product editing screen's functionality meets my needs","woocommerce"),onsubmitLabel:(0,r.__)("Thanks for the feedback — we'll put it to good use!","woocommerce"),getExtraFieldsToBeShown:(e,t,o)=>(0,n.createElement)(n.Fragment,null,(0,n.createElement)(a.BaseControl,{id:"feedback_additional_thoughts",className:"woocommerce-product-feedback__additional-thoughts",label:(0,n.createInterpolateElement)((0,r.__)("ADDITIONAL THOUGHTS <optional />","woocommerce"),{optional:(0,n.createElement)("span",{className:"woocommerce-product-feedback__optional-input"},(0,r.__)("(OPTIONAL)","woocommerce"))})},(0,n.createElement)(a.TextareaControl,{value:e.additional_thoughts||"",onChange:o=>t({...e,additional_thoughts:o}),help:(null==o?void 0:o.additional_thoughts)||""})),(0,n.createElement)(a.BaseControl,{id:"feedback_email",className:"woocommerce-product-feedback__email",label:(0,n.createInterpolateElement)((0,r.__)("YOUR EMAIL ADDRESS <optional />","woocommerce"),{optional:(0,n.createElement)("span",{className:"woocommerce-product-feedback__optional-input"},(0,r.__)("(OPTIONAL)","woocommerce"))})},(0,n.createElement)(a.TextControl,{value:e.email||"",onChange:o=>t({...e,email:o}),help:(null==o?void 0:o.email)||""}),(0,n.createElement)("span",null,(0,r.__)("In case you want to participate in further discussion and future user research.","woocommerce")))),validateExtraFields:e=>{let{email:t="",additional_thoughts:o=""}=e;const n={};return t.length>0&&!(0,s.isValidEmail)(t)&&(n.email=(0,r.__)("Please enter a valid email address.","woocommerce")),(null==o?void 0:o.length)>500&&(n.additional_thoughts=(0,r.__)("Please enter no more than 500 characters.","woocommerce")),n}},{shouldShowComments:()=>!1},{type:"snackbar"},{block_editor:d("product-block-editor")}),t()},icon:(0,n.createElement)(m.A,null),iconPosition:"right"},(0,r.__)("Share feedback","woocommerce"))};var u=o(74617),p=o(67221),_=o(73463);const g=e=>{let{onClick:t,productId:o}=e;const{showProductMVPFeedbackModal:l}=(0,c.useDispatch)(i.STORE_KEY),{allowTracking:s,resolving:m}=(0,c.useSelect)((e=>{const{getOption:t,hasFinishedResolution:o}=e(p.OPTIONS_STORE_NAME);return{allowTracking:"yes"===(t(i.ALLOW_TRACKING_OPTION_NAME)||"no"),resolving:!o("getOption",[i.ALLOW_TRACKING_OPTION_NAME])}})),d=(0,_.O3)("_feature_nonce"),g=o?(0,u.getAdminLink)(`post.php?post=${o}&action=edit&product_block_editor=0&_feature_nonce=${d}`):(0,u.getAdminLink)(`post-new.php?post_type=product&product_block_editor=0&_feature_nonce=${d}`);return m?null:(0,n.createElement)(a.MenuItem,{onClick:function(){s?l():window.location.href=g,t()},info:(0,r.__)("Save changes and go back to the classic product editing screen.","woocommerce")},(0,r.__)("Turn off the new product form","woocommerce"))};var E=o(23374),h=o(84560),w=o(90495),N=o(65545);const b=e=>{let{onClick:t=(()=>null),onCloseGuide:o}=e;const[c,i]=(0,n.useState)(!1),{isNewUser:l}=(0,N.E)();return(0,n.createElement)(n.Fragment,null,(0,n.createElement)(a.MenuItem,{onClick:()=>{i(!0),t()},icon:(0,n.createElement)(E.Z,{icon:h.Z}),iconPosition:"right"},(0,r.__)("About the form…","woocommerce")),c&&(0,n.createElement)(w.Z,{isNewUser:l,onCloseGuide:()=>{i(!1),o()}}))}},19784:(e,t,o)=>{o.d(t,{H:()=>a});var n=o(69307),r=o(51393);const a=e=>{let{product:t}=e;return(0,n.createElement)(n.Fragment,null,t&&(0,n.createElement)(r.__experimentalProductMVPCESFooter,{product:t}),(0,n.createElement)(r.__experimentalProductMVPFeedbackModalContainer,null))}},15859:(e,t,o)=>{o.d(t,{a:()=>m});var n=o(69307),r=o(65736),a=o(55609),c=o(10431),i=o(51393),l=o(83849),s=o.n(l);const m=e=>{let{id:t,product:o}=e;const l=(0,c.getQuery)();(0,n.useEffect)((()=>(window.document.body.classList.add("woocommerce-admin-product-layout"),()=>{window.document.body.classList.remove("woocommerce-admin-product-layout")})),[]);const{adminBarHeight:m,headerHeight:d}=(()=>{const[e,t]=(0,n.useState)(60),[o,r]=(0,n.useState)(32);return(0,n.useEffect)((()=>{const e=document.querySelector("#wpbody"),o=new MutationObserver((()=>{t(parseInt(e.style.marginTop,10))}));return o.observe(e,{attributes:!0}),()=>{o.disconnect()}}),[]),(0,n.useLayoutEffect)((()=>{const e=()=>{const e=document.querySelector("#wpadminbar");r(e.clientHeight)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]),{adminBarHeight:o,headerHeight:e}})();(0,n.useEffect)((()=>{const e=document.querySelector(".product-form-layout .components-tab-panel__tabs");e&&(e.style.top=m+d+"px")}),[m,d]);const u=e=>e.map((e=>({name:e.name,title:e.disabled?(0,n.createElement)(a.Tooltip,{text:(0,r.__)("Manage individual variation details in the Options tab.","woocommerce")},(0,n.createElement)("span",{className:"woocommerce-product-form-tab__item-inner"},(0,n.createElement)("span",{className:"woocommerce-product-form-tab__item-inner-text"},e.title))):(0,n.createElement)("span",{className:"woocommerce-product-form-tab__item-inner"},(0,n.createElement)("span",{className:"woocommerce-product-form-tab__item-inner-text"},e.title)),disabled:e.disabled})));return(0,n.createElement)(n.Fragment,null,(0,n.createElement)(i.__experimentalWooProductTabItem.Slot,{template:"tab/"+t,fillProps:{product:o}},((e,t)=>{var r;return e.length>0?(0,n.createElement)(a.TabPanel,{className:"product-form-layout",activeClass:"is-active",tabs:u(e),initialTabName:null!==(r=l.tab)&&void 0!==r?r:e[0].name,onSelect:e=>{window.document.documentElement.scrollTop=0,(0,c.navigateTo)({url:(0,c.getNewPath)({tab:e})})}},(e=>{const r=s()("woocommerce-product-form-tab","woocommerce-product-form-tab__"+e.name),a=t[e.name];return(0,n.createElement)("div",{className:r,key:e.name},"function"==typeof a?a(o):a)})):null})))}},47492:(e,t,o)=>{o.d(t,{H:()=>A});var n=o(69307),r=o(86020),a=o(98817),c=o(65736),i=o(55609),l=o(23374),s=o(47642),m=o(73224),d=o(46530),u=o(75606),p=o(51393),_=o(14599),g=o(10431),E=o(9818),h=o(90162);const w=()=>{const{createProductWithStatus:e,updateProductWithStatus:t,deleteProductAndRedirect:o,copyProductWithStatus:a,isUpdatingDraft:w,isUpdatingPublished:N,isDeleting:b}=(0,p.__experimentalUseProductHelper)(),{maybeShowFeedbackBar:v}=(0,p.__experimentalUseFeedbackBar)(),{isDirty:I,isValidForm:C,values:f,resetForm:S}=(0,r.useFormContext)();(0,g.useConfirmUnsavedChanges)(I,p.preventLeavingProductForm),(0,u.useCustomerEffortScoreExitPageTracker)(f.id?"editing_new_product":"new_product",I);const{isSmallViewport:x}=(0,E.useSelect)((e=>({isSmallViewport:e(h.store).isViewportMatch("< medium")}))),k=()=>({product_id:f.id,product_type:f.type,is_downloadable:f.downloadable,is_virtual:f.virtual,manage_stock:f.manage_stock}),P=async()=>{if((0,_.recordEvent)("product_update",{source:p.TRACKS_SOURCE,...k()}),f.id){const e=await t(f.id,f,"publish");e&&e.id&&S(e)}else{const t=await e(f,"publish");null!=t&&t.id&&(S(),(0,g.navigateTo)({url:"admin.php?page=wc-admin&path=/product/"+t.id}))}await v()},T=async()=>{(0,_.recordEvent)("product_publish_and_copy",{source:p.TRACKS_SOURCE,...k()}),f.id?await t(f.id,f,"publish"):await e(f,"publish",!1),await a(f)},y=async()=>{(0,_.recordEvent)("product_copy",{source:p.TRACKS_SOURCE,...k()}),f.id&&await t(f.id,f,f.status||"draft"),await a(f)},M=async()=>{if((0,_.recordEvent)("product_delete",{source:p.TRACKS_SOURCE,...k()}),f.id){const e=await o(f.id);null!=e&&e.id&&(S(e),(0,g.navigateTo)({url:"edit.php?post_type=product"}))}},D=f.id&&"publish"===f.status,F=x?i.MenuItem:i.Button,O=(0,n.createElement)(n.Fragment,null,(0,n.createElement)(F,{onClick:async()=>{if((0,_.recordEvent)("product_edit",{source:p.TRACKS_SOURCE,...k()}),f.id){const e=await t(f.id,f,"draft");e&&e.id&&S(e)}else{const t=await e(f,"draft");null!=t&&t.id&&(S(),(0,g.navigateTo)({url:"admin.php?page=wc-admin&path=/product/"+t.id}))}await v()},disabled:!C||!I&&!!f.id&&"publish"!==f.status||w||N||b},!I&&f.id&&"publish"!==f.status&&(0,n.createElement)(l.Z,{icon:s.Z}),w?(0,c.__)("Saving","woocommerce"):null,!I&&f.id||w||"publish"===f.status?null:(0,c.__)("Save draft","woocommerce"),"publish"!==f.status||w?null:(0,c.__)("Switch to draft","woocommerce"),I||!f.id||w||"publish"===f.status?null:(0,c.__)("Saved","woocommerce")),(0,n.createElement)(F,{onClick:()=>(0,_.recordEvent)("product_preview_changes",{source:p.TRACKS_SOURCE,...k()}),href:f.permalink+"?preview=true",disabled:!C||!f.permalink,target:"_blank"},(0,c.__)("Preview","woocommerce")));return(0,n.createElement)(d.WooHeaderItem,null,(()=>(0,n.createElement)("div",{className:"woocommerce-product-form-actions"},!x&&O,(0,n.createElement)(i.ButtonGroup,{className:"woocommerce-product-form-actions__publish-button-group"},(0,n.createElement)(i.Button,{onClick:P,variant:"primary",isBusy:N,disabled:!C||!I&&!!D||w||N||b},N?(0,c.__)("Updating","woocommerce"):null,D&&!N?(0,c.__)("Update","woocommerce"):null,D||N?null:(0,c.__)("Publish","woocommerce")),(0,n.createElement)(i.DropdownMenu,{className:"woocommerce-product-form-actions__publish-dropdown",label:(0,c.__)("Publish options","woocommerce"),icon:m.Z,popoverProps:{position:"bottom left"},toggleProps:{variant:"primary",disabled:!f.id&&!C}},(()=>(0,n.createElement)(n.Fragment,null,(0,n.createElement)(i.MenuGroup,null,x&&O,(0,n.createElement)(i.MenuItem,{onClick:T,disabled:!C},D?(0,c.__)("Update & duplicate","woocommerce"):(0,c.__)("Publish & duplicate","woocommerce")),(0,n.createElement)(i.MenuItem,{onClick:y,disabled:!C},(0,c.__)("Copy to a new draft","woocommerce")),f.id&&(0,n.createElement)(i.MenuItem,{onClick:M,isDestructive:!0},(0,c.__)("Move to trash","woocommerce"))))))))))};(0,a.registerPlugin)("action-buttons-header-item",{render:w,icon:"admin-generic"});var N=o(85797),b=o(67221),v=o(56159);const I=()=>{const{values:e}=(0,r.useFormContext)(),{resolving:t}=(0,E.useSelect)((e=>{const{hasFinishedResolution:t}=e(b.OPTIONS_STORE_NAME);return{resolving:!t("getOption",[u.ALLOW_TRACKING_OPTION_NAME])}}));return t?null:(0,n.createElement)(d.WooHeaderItem,null,(0,n.createElement)(i.DropdownMenu,{className:"woocommerce-product-form-more-menu",label:(0,c.__)("More product options","woocommerce"),icon:N.Z,popoverProps:{position:"bottom left"}},(t=>{let{onClose:o}=t;return(0,n.createElement)(n.Fragment,null,(0,n.createElement)(v.b,{onClick:o}),(0,n.createElement)(v.U_,{productId:e.id,onClick:o}))})))};var C=o(5267),f=o(78018),S=o(28601);const x=()=>{const{getCheckboxControlProps:e,getInputProps:t}=(0,r.useFormContext)(),[o,a]=(0,n.useState)(!1);return(0,n.createElement)(d.WooHeaderItem,null,(0,n.createElement)(n.Fragment,null,(0,n.createElement)(i.Button,{"aria-label":(0,c.__)("Settings","woocommerce"),icon:f.Z,isPressed:o,onClick:()=>a(!o),className:"woocommerce-product-settings__toggle"}),o&&(0,n.createElement)(i.Panel,{className:"woocommerce-product-settings__panel"},(0,n.createElement)(i.PanelHeader,{label:(0,c.__)("Settings","woocommerce")},(0,n.createElement)(i.Button,{icon:S.Z,onClick:()=>a(!1),"aria-label":(0,c.__)("Close settings","woocommerce")})),(0,n.createElement)(i.PanelBody,{title:(0,c.__)("Advanced","woocommerce")},(0,n.createElement)(i.CheckboxControl,(0,C.Z)({label:(0,c.__)("Enable reviews","woocommerce")},e("reviews_allowed",(0,p.getCheckboxTracks)("reviews_allowed")))),(0,n.createElement)(i.TextControl,(0,C.Z)({label:(0,c.__)("Menu order","woocommerce"),type:"number"},t("menu_order")))))))};var k=o(58378);const P=()=>(0,n.createElement)(n.Fragment,null,(0,n.createElement)(k.t,null),(0,n.createElement)(w,null),(0,n.createElement)(x,null),(0,n.createElement)(I,null));var T=o(15859),y=o(76292),M=o.n(y);function D(e){const t={},o=M()(e.date_on_sale_from_gmt,M().ISO_8601,!0),n=M()(e.date_on_sale_to_gmt,M().ISO_8601,!0);return e.date_on_sale_from_gmt&&!o.isValid()&&(t.date_on_sale_from_gmt=(0,c.__)("Please enter a valid date.","woocommerce")),e.date_on_sale_to_gmt&&!n.isValid()&&(t.date_on_sale_to_gmt=(0,c.__)("Please enter a valid date.","woocommerce")),o.isAfter(n)&&(t.date_on_sale_from_gmt=(0,c.__)("The start date of the sale must be before the end date.","woocommerce")),n.isBefore(o)&&(t.date_on_sale_to_gmt=(0,c.__)("The end date of the sale must be after the start date.","woocommerce")),t}const F=e=>{var t,o,n,r;let a={};var i,l;return a=((e,t)=>{const o={...t};return e.stock_quantity&&e.stock_quantity<0&&(o.stock_quantity=(0,c.__)("Stock quantity must be a positive number.","woocommerce")),e.low_stock_amount&&e.low_stock_amount<0&&(o.low_stock_amount=(0,c.__)("Stock quantity must be a positive number.","woocommerce")),o})(e,a),null!==(t=e.name)&&void 0!==t&&t.length||(a.name=(0,c.__)("This field is required.","woocommerce")),e.name&&e.name.length>120&&(a.name=(0,c.__)("Please enter a product name shorter than 120 characters.","woocommerce")),e.regular_price&&!/^[0-9.,]+$/.test(e.regular_price)&&(a.regular_price=(0,c.__)("Please enter a price with one monetary decimal point without thousand separators and currency symbols.","woocommerce")),e.sale_price&&!/^[0-9.,]+$/.test(e.sale_price)&&(a.sale_price=(0,c.__)("Please enter a price with one monetary decimal point without thousand separators and currency symbols.","woocommerce")),e.sale_price&&(!e.regular_price||parseFloat(e.sale_price)>=parseFloat(null==e?void 0:e.regular_price))&&(a.sale_price=(0,c.__)("Sale price cannot be equal to or higher than list price.","woocommerce")),a={...a,...D(e)},null!==(o=e.dimensions)&&void 0!==o&&o.width&&+e.dimensions.width<=0&&(a.dimensions={width:(0,c.__)("Width must be higher than zero.","woocommerce")}),null!==(n=e.dimensions)&&void 0!==n&&n.length&&+e.dimensions.length<=0&&(a.dimensions={...null!==(i=a.dimensions)&&void 0!==i?i:{},length:(0,c.__)("Length must be higher than zero.","woocommerce")}),null!==(r=e.dimensions)&&void 0!==r&&r.height&&+e.dimensions.height<=0&&(a.dimensions={...null!==(l=a.dimensions)&&void 0!==l?l:{},height:(0,c.__)("Height must be higher than zero.","woocommerce")}),e.weight&&+e.weight<=0&&(a.weight=(0,c.__)("Weight must be higher than zero.","woocommerce")),a};var O=o(19784);const A=e=>{let{product:t,formRef:o}=e;return(0,n.createElement)(r.SlotContextProvider,null,(0,n.createElement)(r.Form,{initialValues:t||{backorders:"no",name:"",reviews_allowed:!0,sku:"",stock_quantity:0,stock_status:"instock"},ref:o,errors:{},validate:F},(0,n.createElement)(P,null),(0,n.createElement)(T.a,{id:"general",product:t}),(0,n.createElement)(O.H,{product:t}),(0,n.createElement)(a.PluginArea,{scope:"woocommerce-product-editor"})))}},58378:(e,t,o)=>{o.d(t,{t:()=>N});var n=o(69307),r=o(65736),a=o(46530),c=o(67221),i=o(74617),l=o(10431),s=o(51393),m=o(86020),d=o(85597),u=o(9818),p=o(23374),_=o(81694);const g=e=>{let{breadcrumbs:t}=e;const o=t.length>3?[t[0],{title:(0,n.createElement)(n.Fragment,null,"…")},t[t.length-1]]:t;return(0,n.createElement)("span",{className:"woocommerce-product-breadcrumbs"},o.map((e=>{const{href:t,title:o,type:r}=e;return(0,n.createElement)(n.Fragment,{key:t},(0,n.createElement)("span",{className:"woocommerce-product-breadcrumbs__item"},t?(0,n.createElement)(m.Link,{href:t,type:r||"wp-admin"},o):o),(0,n.createElement)("span",{className:"woocommerce-product-breadcrumbs__separator"},(0,n.createElement)(p.Z,{icon:_.Z})))})))};var E=o(83849),h=o.n(E);const w=()=>{const{productId:e}=(0,d.UO)(),t=(0,u.useSelect)((t=>e?t(c.PRODUCTS_STORE_NAME).getProduct(parseInt(e,10),void 0):void 0)),o=(0,s.getProductStatus)(t);return(0,n.createElement)(m.Pill,{className:h()("woocommerce-product-status",`is-${o}`)},s.PRODUCT_STATUS_LABELS[o])},N=()=>{const{values:e}=(0,m.useFormContext)(),{productId:t,variationId:o}=(0,d.UO)(),{isLoading:p,persistedName:_,productVariation:E}=(0,u.useSelect)((e=>{const{getProduct:n,hasFinishedResolution:r}=e(c.PRODUCTS_STORE_NAME),{getProductVariation:a,hasFinishedResolution:i}=e(c.EXPERIMENTAL_PRODUCT_VARIATIONS_STORE_NAME),l=t?n(parseInt(t,10)):null,s=o&&t?a({id:parseInt(o,10),product_id:parseInt(t,10)}):null,m=t&&!r("getProduct",[parseInt(t,10)]),d=o&&t&&!i("getProductVariation",[{id:parseInt(o,10),product_id:parseInt(t,10)}]);return{persistedName:null==l?void 0:l.name,productVariation:s,isLoading:m||d}})),h=(0,s.getProductTitle)(e.name,e.type,_),N=E&&(0,s.getProductVariationTitle)(E),b=[{href:(0,i.getAdminLink)("edit.php?post_type=product"),title:(0,r.__)("Products","woocommerce")},{href:(0,l.getNewPath)({},"/product/"+t),type:"wc-admin",title:(0,n.createElement)(n.Fragment,null,h,(0,n.createElement)(w,null))},N&&{title:(0,n.createElement)("span",{title:N},(0,s.getTruncatedProductVariationTitle)(E))}].filter((e=>!!e)),v=b.pop();return p?null:(0,n.createElement)(a.WooHeaderPageTitle,null,(0,n.createElement)("span",{className:"woocommerce-product-title"},(0,n.createElement)(g,{breadcrumbs:b}),(0,n.createElement)("span",{className:"woocommerce-product-title__wrapper"},null==v?void 0:v.title)))}},90495:(e,t,o)=>{o.d(t,{Z:()=>_});var n=o(69307),r=o(65736),a=o(83849),c=o.n(a),i=o(55609),l=o(70444);const s=e=>{let{isSelected:t}=e;return(0,n.createElement)(l.SVG,{width:"8",height:"8",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,n.createElement)(l.Circle,{cx:"4",cy:"4",r:"4",fill:t?"#419ECD":"#E1E3E6"}))};function m(e){let{currentPage:t,numberOfPages:o,setCurrentPage:a}=e;return(0,n.createElement)("ul",{className:"components-guide__page-control","aria-label":(0,r.__)("Guide controls","woocommerce")},Array.from({length:o}).map(((e,c)=>(0,n.createElement)("li",{key:c,"aria-current":c===t?"step":void 0},(0,n.createElement)(i.Button,{key:c,icon:(0,n.createElement)(s,{isSelected:c===t}),"aria-label":(0,r.sprintf)((0,r.__)("Page %1$d of %2$d","woocommerce"),c+1,o),onClick:()=>a(c)})))))}const d=function(e){let{className:t,contentLabel:o,finishButtonText:a=(0,r.__)("Finish","woocommerce"),finishButtonLink:l,onFinish:s,pages:d=[]}=e;const u=(0,n.useRef)(null),[p,_]=(0,n.useState)(0),g=p>0,E=p<d.length-1,h=()=>{g&&_(p-1)},w=()=>{E&&_(p+1)};return 0===d.length?null:(0,n.createElement)(i.Modal,{className:c()("components-guide",t),title:o,onRequestClose:()=>{s(p,"close")},onKeyDown:e=>{"ArrowLeft"===e.code?(h(),e.preventDefault()):"ArrowRight"===e.code&&(w(),e.preventDefault())},ref:u},(0,n.createElement)("div",{className:"components-guide__container"},(0,n.createElement)("div",{className:"components-guide__page"},d[p].image,d.length>1&&(0,n.createElement)(m,{currentPage:p,numberOfPages:d.length,setCurrentPage:_}),d[p].content),(0,n.createElement)("div",{className:"components-guide__footer"},g&&(0,n.createElement)(i.Button,{className:"components-guide__back-button",variant:"tertiary",onClick:h},(0,r.__)("Previous","woocommerce")),E&&(0,n.createElement)(i.Button,{className:"components-guide__forward-button",variant:"primary",onClick:w},(0,r.__)("Next","woocommerce")),!E&&(0,n.createElement)(i.Button,{className:"components-guide__finish-button",variant:"primary",href:l,target:l?"_blank":void 0,rel:l?"noopener":void 0,onClick:()=>s(p,"finish")},a))))},u=e=>{let{page:t}=e;return(0,n.createElement)(n.Fragment,null,(0,n.createElement)("h1",{className:"woocommerce-block-editor-guide__heading"},t.heading),(0,n.createElement)("p",{className:"woocommerce-block-editor-guide__text"},t.text))},p=e=>{let{page:t}=e;return(0,n.createElement)("div",{className:`woocommerce-block-editor-guide__header woocommerce-block-editor-guide__header-${t.index+1}`})},_=e=>{let{onCloseGuide:t}=e;const o=[{heading:(0,r.__)("Fresh and modern interface","woocommerce"),text:(0,r.__)("Everything you need to create and sell your products, all in one place. From photos and descriptions to pricing and inventory, all of your product settings can be found here.","woocommerce")},{heading:(0,r.__)("Content-rich product descriptions","woocommerce"),text:(0,r.__)("Show off what's great about your products and engage your customers with content-rich product descriptions. Add images, videos, and any other content they might need to make a purchase.","woocommerce")},{heading:(0,r.__)("Lightning fast performance ","woocommerce"),text:(0,r.__)("Get your products listed and available for purchase in no time! Our modern technology ensures a reliable and streamlined experience.","woocommerce")},{heading:(0,r.__)("More features are on the way","woocommerce"),text:(0,r.__)("We're actively working on adding more features to the product form, including the ability to add digital products, variations, and more. Watch this space!","woocommerce")}].map(((e,t)=>({content:(0,n.createElement)(u,{page:e}),image:(0,n.createElement)(p,{page:{...e,index:t}})})));return(0,n.createElement)(d,{className:"woocommerce-block-editor-guide",contentLabel:"",finishButtonText:(0,r.__)("Tell me more","woocommerce"),finishButtonLink:"https://woocommerce.com/product-form-beta",onFinish:t,pages:o})}},65545:(e,t,o)=>{o.d(t,{E:()=>c});var n=o(67221),r=o(9818);const a={status:"publish",_fields:["id"]},c=()=>(0,r.useSelect)((e=>{const{getProductsTotalCount:t,hasFinishedResolution:o}=e(n.PRODUCTS_STORE_NAME),r=t(a,0);return{publishedProductsCount:r,loadingPublishedProductsCount:!o("getProductsTotalCount",[a,0]),isNewUser:r<1}}))},34537:e=>{e.exports=""},43729:(e,t,o)=>{e.exports=o.p+"46f3be5272a3932c5a1a.png"}}]);